<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>编辑</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <#assign base=request.contextPath  />
    <link rel="stylesheet" href="${base}/frame/layui/css/layui.css?t=1534970980648" media="all">
    <script type="text/javascript" src="${base}/js/zhang.js"></script>
    <script src="${base}/frame/layui/layui.all.js" charset="utf-8"></script>
    <script src="${base}/js/jquery/jquery.min.js"></script>
    <style type="text/css">
        form {
            padding: 20px;
        }

        .layui-btn-radius {
            border-radius: 5px;
        }

        .layui-table-cell {
            height: auto;
            white-space: normal;
        }
    </style>
</head>
<body>
<form class="layui-form" action="">
    <input type="hidden" id="id"/>


    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">回执</label>
            <div class="layui-input-inline">
                <textarea name="receipt" id="receipt" style="width:230px;height: 100px;" autocomplete="off" ></textarea>

            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-inline">
                <textarea name="remarks" id="remarks"  style="width:230px;height: 100px;" autocomplete="off"></textarea>

            </div>
        </div>
    </div>


    <div class="layui-form-item" style="text-align:center">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-radius" lay-submit lay-filter="formDemo" type="button" id="aa"
                    onclick="onSubmit()" style="background-color: #0092EF;">立即提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-radius">重置</button>
        </div>
    </div>
</form>
<script>


    layui.use(['form', 'layedit', 'laydate', 'layer', 'upload'], function () {
        var form = layui.form
            , layer = layui.layer
            , layedit = layui.layedit
            , laydate = layui.laydate;

    })
</script>
<script>




    //添加
    function onSubmit() {
        if($("#receipt").val()==""){
            layer.msg("回执不能为空")
            return;
        }

        var jsonData = {};
        //回执
        jsonData.receipt = $("#receipt").val();
        jsonData.remarks = $("#remarks").val();
        jsonData.id = '${id}';
        $.ajax({
            type: "POST",
            contentType: "application/json;charset=UTF-8",
            url: "${base}/user/updateById",
            data: JSON.stringify(jsonData),
            success: function (data) {
                if (data.code === 0) {
                    layer.msg("修改成功");
                    setTimeout(function () {
                        var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        parent.layer.close(index); //再执行关闭
                    }, 500)
                    var table = parent.layui.table;
                    //表刷新方法
                    table.reload('testReload', {
                        url: '${base}/user/selectMyPage'
                        , where: {} //设定异步数据接口的额外参数
                        //,height: 300
                    });
                } else {
                    layer.msg(data.msg);
                }


            }
        });
    }
</script>

</body>
</html>
